package com.lianxi

import java.util.Scanner

/**
  * Created by adengdeng on 2017/8/8 
  */
object Lx3 {

  def main(args: Array[String]): Unit = {
    var map = new scala.collection.immutable.HashMap[String,Int]
    val in = new Scanner(new java.io.File("myfile.txt"))
    while (in.hasNext()){
      val str = in.next()
      //元组 + 元组(str -> Int)
      map = map + (str -> (map.getOrElse(str, 0) + 1))
    }

    println(map.mkString(" "))
  }
}
